# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: server\http_responses\json_serializable.py
__author__ = "sanyi"
from server.http_responses.base import BaseResponse
from helpers.json_extra import json_iter_encoder


class JsonSerializableResponse(BaseResponse):
    def __init__(
        self,
        body=None,
        headers=None,
        response_status="200 OK",
        cookie=None,
        disable_cache=True,
    ):
        if headers is None:
            headers = {"Content-type": "application/json; charset=utf8"}
        else:
            headers["Content-type"] = "application/json; charset=utf8"
        super().__init__(body, headers, response_status, cookie, disable_cache)

    def __call__(self):
        yield from json_iter_encoder(self.body)
